﻿using Easy.MetaData;
using Easy.Web.CMS;
using Easy.Web.CMS.MetaData;
using Easy.Web.CMS.Widget;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace Easy.CMS.List.Models
{
    [DataConfigure(typeof(ListDetailWidgetMeta)), Serializable]
    public class ListDetailWidget : WidgetBase
    {
        public string CustomerClass { get; set; }

        public string FormCode { get; set; }

        public string Head { get; set; }

        public string Content { get; set; }
    }

    class ListDetailWidgetMeta : WidgetMetaData<ListDetailWidget>
    {
        protected override void ViewConfigure()
        {
            base.ViewConfigure();
            ViewConfig(m => m.CustomerClass).AsHidden();

            ViewConfig(m => m.Head).AsTextBox().ReadOnly().Order(NextOrder()).AddClass("select").AddProperty("data-url", string.Format("{0}?SetField={1}", Urls.SelectField, "Head"));
            ViewConfig(m => m.Content).AsTextBox().ReadOnly().Order(NextOrder()).AddClass("select").AddProperty("data-url", string.Format("{0}?SetField={1}", Urls.SelectField, "Content"));
            ViewConfig(m => m.FormCode).AsTextBox().ReadOnly().Order(NextOrder());
            ViewConfig(m => m.CustomerClass).AsHidden();
        }
    }
}